Socket
Socket
Sign inDemoInstall

metavm

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metavm

Metarhia script loader, node.js vm wrapper


Version published
Weekly downloads
145
decreased by-41.3%
Maintainers
0
Weekly downloads
 
Created
Source

Metarhia script loader, node.js vm wrapper

ci status snyk npm version npm downloads/month npm downloads license

Create script from string

Script contains object expression. You can use it for configs, network packets, serialization format, etc.

const metavm = require('metavm');

const src = `({ field: 'value' });`;
const ms = metavm.createScript('Example', src);
console.log(ms);

Output:

MetaScript {
  name: 'Example',
  script: Script {},
  context: {},
  exports: { field: 'value' }
}

Script contains function expression. You can use it for api endpoints, domain logic stored in files or database, etc.

const metavm = require('metavm');

const src = `(a, b) => a + b;`;
const ms = metavm.createScript('Example', src);
console.log(ms);

Output:

MetaScript {
  name: 'Example',
  script: Script {},
  context: {},
  exports: [Function]
}

Read script from file

const metavm = require('.');

(async () => {
  const ms = await metavm.readScript('./test/examples/simple.js');
  console.log(ms);
})();

Output:

MetaScript {
  name: 'simple',
  script: Script {},
  context: {},
  exports: { field: 'value', add: [Function: add], sub: [Function: sub] }
}

License & Contributors

Copyright (c) 2020-2023 Metarhia contributors. Metavm is MIT licensed.
Metavm is a part of Metarhia technology stack.

Keywords

FAQs

Package last updated on 31 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc